package com.itheima.customer.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.itheima.customer.dao.IBaseDictDao;
import com.itheima.customer.domain.BaseDict;

@Repository("basedictDao")
public class baseDictDaoImpl implements IBaseDictDao {

	@Autowired
	private HibernateTemplate hibernateTemplate;
	
	@Override
	public List<BaseDict> findBaseDictByTypeCode(String typeCode) {
		
		return (List<BaseDict>) hibernateTemplate.find("from BaseDict where dictTypeCode=?", typeCode);
	}

	@Override
	public BaseDict findById(String dictId) {
		
		return hibernateTemplate.get(BaseDict.class, dictId);
	}

}
